/**
* We don't want an HTMLForm
+ * @return bool
*/
protected function getFormFields() {
return false;
* possible. If sucessful, the AjaxResponse is disabled so that
* any future call to AjaxResponse::printText() have no effect. The method
* returns true iff the response code was set to 304 Not Modified.
+ * @return bool
*/
function checkLastModified ( $timestamp ) {
global $wgCachePages, $wgCacheEpoch, $wgUser;
*
* @param $fname String Name of called method
* @param $args Array Arguments to the method
+ * @return mixed
*/
public function __call( $fname, $args ) {
if ( is_callable( array( $this->mPage, $fname ) ) ) {
* forget the & on your function declaration.
*
* @param $user User object
+ * @return bool
*/
public function updateUser( &$user ) {
# Override this and do something
/**
* Get the field name prefix for a given table
* @param $table String
+ * @return null|string
*/
protected function getPrefix( $table ) {
static $prefixes = array(
* Get the SQL condition array for selecting backlinks, with a join
* on the page table.
* @param $table String
+ * @return array|null
*/
protected function getConditions( $table ) {
$prefix = $this->getPrefix( $table );
);
}
- /** Generic accessor */
+ /**
+ * Generic accessor
+ * @return bool
+ */
private function getX( $key ) {
if ( !$this->initialize() ) {
return false;
/**
* Constructor from a page id
* @param $id Int article ID to load
+ * @return CategoryPage|null
*/
public static function newFromID( $id ) {
$t = Title::newFromID( $id );
*
* @param Title $title
* @param string $sortkey The human-readable sortkey (before transforming to icu or whatever).
- */
+ * @return string
+ */
function getSubcategorySortChar( $title, $sortkey ) {
global $wgContLang;
* Insert a formatted action
*
* @param $rc RecentChange
+ * @return string
*/
public function insertLogEntry( $rc ) {
$formatter = LogFormatter::newFromRow( $rc->mAttribs );
/**
* Insert a formatted comment
* @param $rc RecentChange
+ * @return string
*/
public function insertComment( $rc ) {
if( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) {
/**
* Returns the string which indicates the number of watching users
+ * @return string
*/
protected function numberofWatchingusers( $count ) {
static $cache = array();
* Format a line using the old system (aka without any javascript).
*
* @param $rc RecentChange
+ * @return string
*/
public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
global $wgRCShowChangedSize;
/**
* Enhanced RC group
+ * @return string
*/
protected function recentChangesBlockGroup( $block ) {
global $wgRCShowChangedSize;
* insert
* Insert a new element at the start of the array.
*
+ * @return string
*/
public function edit( $ops ) {
$this->parse();
* Finds the source byte region which you would want to delete, if $pathName
* was to be deleted. Includes the leading spaces and tabs, the trailing line
* break, and any comments in between.
+ * @return array
*/
function findDeletionRegion( $pathName ) {
if ( !isset( $this->pathInfo[$pathName] ) ) {
* or semicolon.
*
* The end position is the past-the-end (end + 1) value as per convention.
+ * @return array
*/
function findValueRegion( $pathName ) {
if ( !isset( $this->pathInfo[$pathName] ) ) {
* Find the path name of the last element in the array.
* If the array is empty, this will return the \@extra interstitial element.
* If the specified path is not found or is not an array, it will return false.
+ * @return bool|int|string
*/
function findLastArrayElement( $path ) {
// Try for a real element
* Find the path name of first element in the array.
* If the array is empty, this will return the \@extra interstitial element.
* If the specified path is not found or is not an array, it will return false.
+ * @return bool|int|string
*/
function findFirstArrayElement( $path ) {
// Try for an ordinary element
/**
* Get the indent string which sits after a given start position.
* Returns false if the position is not at the start of the line.
+ * @return array
*/
function getIndent( $pos, $key = false, $arrowPos = false ) {
$arrowIndent = ' ';
/**
* Create a ConfEditorToken from an element of token_get_all()
+ * @return \ConfEditorToken
*/
function newTokenObj( $internalToken ) {
if ( is_array( $internalToken ) ) {
/**
* Get the token $offset steps ahead of the current position.
* $offset may be negative, to get tokens behind the current position.
+ * @return \ConfEditorToken
*/
function getTokenAhead( $offset ) {
$pos = $this->pos + $offset;
/**
* Pop a state from the state stack.
+ * @return mixed
*/
function popState() {
return array_pop( $this->stateStack );
/**
* Returns true if the user input path is valid.
* This exists to allow "/" and "@" to be reserved for string path keys
+ * @return bool
*/
function validatePath( $path ) {
return strpos( $path, '/' ) === false && substr( $path, 0, 1 ) != '@';
/**
* Get a readable name for the given token type.
+ * @return string
*/
function getTypeName( $type ) {
if ( is_int( $type ) ) {
* Looks ahead to see if the given type is the next token type, starting
* from the current position plus the given offset. Skips any intervening
* whitespace.
+ * @return bool
*/
function isAhead( $type, $offset = 0 ) {
$ahead = $offset;
/**
* @see Cookie::serializeToHttpRequest
+ * @return string
*/
public function serializeToHttpRequest( $path, $domain ) {
$cookies = array();
*
* @param $cookie String
* @param $domain String: cookie's domain
+ * @return null
*/
public function parseCookieResponseHeader ( $cookie, $domain ) {
$len = strlen( 'Set-Cookie:' );
* Closes a <page> section on the output stream.
*
* @access private
+ * @return string
*/
function closePage() {
return " </page>\n";
/**
* Warning! This data is potentially inconsistent. :(
+ * @return string
*/
function writeUploads( $row, $dumpContents = false ) {
if ( $row->page_namespace == NS_IMAGE ) {
/**
* Returns the name of the file or files which are
* being written to, if there are any.
+ * @return null
*/
function getFilenames() {
return NULL;
/**
* Fetch data from given URL
* @param $url String: an url of the form DB://cluster/id or DB://cluster/id/itemid for concatened storage.
+ * @return mixed
*/
function fetchFromURL( $url ) {
$path = explode( '/', $url );
class AtomFeed extends ChannelFeed {
/**
* @todo document
+ * @return string
*/
function formatTime( $ts ) {
// need to use RFC 822 time format at least for rss2.0
* @param $title Title object: used to generate the diff URL
* @param $newid Integer newid for this diff
* @param $oldid Integer|null oldid for the diff. Null means it is a new article
+ * @return string
*/
protected static function getDiffLink( Title $title, $newid, $oldid = null ) {
$queryParameters = ($oldid == null)
* @param $reason String: reason of the deletion
* @param $suppress Boolean: whether to mark all deleted versions as restricted
* @param $user User object performing the request
+ * @return bool|Status
*/
public static function doDelete( &$title, &$file, &$oldimage, $reason, $suppress, User $user = null ) {
if ( $user === null ) {
* This will return 'child' in the child processes. In the parent process,
* it will run until all the child processes exit or a TERM signal is
* received. It will then return 'done'.
+ * @return string
*/
public function start() {
// Trap SIGTERM
* @see http://php.net/manual/en/class.arrayaccess.php
*/
/* @{ */
- /** Whether option exist*/
+ /**
+ * Whether option exist
+ * @return bool
+ */
public function offsetExists( $name ) {
return isset( $this->options[$name] );
}
- /** Retrieve an option value */
+ /**
+ * Retrieve an option value
+ * @return Mixed
+ */
public function offsetGet( $name ) {
return $this->getValue( $name );
}
*/
if( !function_exists( 'iconv' ) ) {
- /** @codeCoverageIgnore */
+ /**
+ * @codeCoverageIgnore
+ * @return string
+ */
function iconv( $from, $to, $string ) {
return Fallback::iconv( $from, $to, $string );
}
}
if ( !function_exists( 'mb_substr' ) ) {
- /** @codeCoverageIgnore */
+ /**
+ * @codeCoverageIgnore
+ * @return string
+ */
function mb_substr( $str, $start, $count='end' ) {
return Fallback::mb_substr( $str, $start, $count );
}
- /** @codeCoverageIgnore */
+ /**
+ * @codeCoverageIgnore
+ * @return int
+ */
function mb_substr_split_unicode( $str, $splitPos ) {
return Fallback::mb_substr_split_unicode( $str, $splitPos );
}
}
if ( !function_exists( 'mb_strlen' ) ) {
- /** @codeCoverageIgnore */
+ /**
+ * @codeCoverageIgnore
+ * @return int
+ */
function mb_strlen( $str, $enc = '' ) {
return Fallback::mb_strlen( $str, $enc );
}
}
if( !function_exists( 'mb_strpos' ) ) {
- /** @codeCoverageIgnore */
+ /**
+ * @codeCoverageIgnore
+ * @return int
+ */
function mb_strpos( $haystack, $needle, $offset = 0, $encoding = '' ) {
return Fallback::mb_strpos( $haystack, $needle, $offset, $encoding );
}
}
if( !function_exists( 'mb_strrpos' ) ) {
- /** @codeCoverageIgnore */
+ /**
+ * @codeCoverageIgnore
+ * @return int
+ */
function mb_strrpos( $haystack, $needle, $offset = 0, $encoding = '' ) {
return Fallback::mb_strrpos( $haystack, $needle, $offset, $encoding );
}
// Support for Wietse Venema's taint feature
if ( !function_exists( 'istainted' ) ) {
- /** @codeCoverageIgnore */
+ /**
+ * @codeCoverageIgnore
+ * @return int
+ */
function istainted( $var ) {
return 0;
}
/**
* Returns true if debug logging should be suppressed if $wgDebugRawPage = false
+ * @return bool
*/
function wfIsDebugRawPage() {
static $cache;
*
* @param $fh handle
* @param $content String
+ * @return int
*/
public function read( $fh, $content ) {
$this->content .= $content;
/**
* isEmpty() returns true if the gallery contains no images
+ * @return bool
*/
function isEmpty() {
return empty( $this->mImages );
* - the additional text provided when adding the image
* - the size of the image
*
+ * @return string
*/
function toHTML() {
global $wgLang;
/**
* Constructor from a page id
* @param $id Int article ID to load
+ * @returnImagePage|null
*/
public static function newFromID( $id ) {
$t = Title::newFromID( $id );
/**
* Primary entry point
+ * @return bool
*/
public function doImport() {
$this->reader->read();
/**
* Get the "prevent clickjacking" flag
+ * @return bool
*/
function getPreventClickjacking() {
return $this->preventClickjacking;
}
/**
* Get an uplaod result based on upload context
+ * @return array
*/
private function getContextResult(){
$warnings = $this->getApiWarnings();
return $this->performUpload();
}
/**
- * Get Stash Result, throws an expetion if the file could not be stashed.
+ * Get Stash Result, throws an expetion if the file could not be stashed.
+ * @return array
*/
private function getStashResult(){
$result = array ();
/**
* Get Warnings Result
* @param $warnings Array of Api upload warnings
+ * @return array
*/
private function getWarningsResult( $warnings ){
$result = array();
return $result;
}
/**
- * Get the result of a chunk upload.
+ * Get the result of a chunk upload.
+ * @return array
*/
private function getChunkResult(){
$result = array();
* is disabled.
*
* @param $code String: language to which load messages
+ * @return bool
*/
function load( $code = false ) {
global $wgUseLocalMessageCache;
* Same as new factory( ... ), kept for backward compatibility
* @deprecated since 1.18
* @see Database::factory()
+ * @return DatabaseBase
*/
public final static function newFromType( $dbType, $p = array() ) {
wfDeprecated( __METHOD__, '1.18' );
/**
* Returns true if this database supports (and uses) cascading deletes
+ * @return bool
*/
function cascadingDeletes() {
return true;
/**
* Returns true if this database supports (and uses) triggers (e.g. on the
* page table)
+ * @return bool
*/
function cleanupTriggers() {
return true;
* Returns true if this database is strict about what can be put into an
* IP field.
* Specifically, it uses a NULL value instead of an empty string.
+ * @return bool
*/
function strictIPs() {
return true;
/**
* Returns true if this database uses timestamps rather than integers
- */
+ * @return bool
+ */
function realTimestamps() {
return true;
}
/**
* Returns true if this database does an implicit sort when doing GROUP BY
+ * @return bool
*/
function implicitGroupby() {
return false;
* Returns true if this database does an implicit order by when the column
* has an index
* For example: SELECT page_title FROM page LIMIT 1
+ * @return bool
*/
function implicitOrderby() {
return false;
/**
* Returns true if this database can do a native search on IP columns
* e.g. this works as expected: .. WHERE rc_ip = '127.42.12.102/32';
+ * @return bool
*/
function searchableIPs() {
return true;
/**
* Returns true if this database can use functional indexes
+ * @return bool
*/
function functionalIndexes() {
return true;
/**
* Returns a unique string representing the wiki on the server
+ * @return string
*/
public function getWikiID() {
if( $this->mSchema ) {
/**
* Closes a database connection, if it is open
* Returns success, true if already closed
+ * @return bool
*/
public function close() {
$this->mOpened = false;
/**
* Retrieves the most current database error
* Forces a database rollback
+ * @return bool|string
*/
public function lastError() {
$connerr = db2_conn_errormsg();
* LIST_SET - comma separated with field names, like a SET clause
* LIST_NAMES - comma separated field names
* LIST_SET_PREPARED - like LIST_SET, except with ? tokens as values
+ * @return string
*/
function makeList( $a, $mode = LIST_COMMA ) {
if ( !is_array( $a ) ) {
* @param $sql string SQL query we will append the limit too
* @param $limit integer the SQL limit
* @param $offset integer the SQL offset (default false)
+ * @return string
*/
public function limitResult( $sql, $limit, $offset=false ) {
if( !is_numeric( $limit ) ) {
* DELETE query wrapper
*
* Use $conds == "*" to delete all rows
+ * @return bool|\ResultWrapper
*/
public function delete( $table, $conds, $fname = 'DatabaseIbm_db2::delete' ) {
if ( !$conds ) {
* in the appropriate places.
* @param $query String
* @param $args ...
+ * @return Resource
*/
public function safeQuery( $query, $args = null ) {
// copied verbatim from Database.php
/**
* Switches module between regular and install modes
+ * @return string
*/
public function setMode( $mode ) {
$old = $this->mMode;
/**
* Usually aborts on failure
+ * @return bool|DatabaseBase|null
*/
function open( $server, $user, $password, $dbName ) {
# Test for driver support, to avoid suppressed fatal error
/**
* Closes a database connection, if it is open
* Returns success, true if already closed
+ * @return bool
*/
function close() {
$this->mOpened = false;
/**
* This must be called after nextSequenceVal
+ * @return null
*/
function insertId() {
return $this->mInsertId;
* This is not necessarily an accurate estimate, so use sparingly
* Returns -1 if count cannot be found
* Takes same arguments as Database::select()
+ * @return int
*/
function estimateRowCount( $table, $vars = '*', $conds = '', $fname = 'DatabaseMssql::estimateRowCount', $options = array() ) {
$options['EXPLAIN'] = true;// http://msdn2.microsoft.com/en-us/library/aa259203.aspx
/**
* Returns information about an index
* If errors are explicitly ignored, returns NULL on failure
+ * @return array|bool|null
*/
function indexInfo( $table, $index, $fname = 'DatabaseMssql::indexExists' ) {
# This does not return the same info as MYSQL would, but that's OK because MediaWiki never uses the
*
* Usually aborts on failure
* If errors are explicitly ignored, returns success
+ * @return bool
*/
function insert( $table, $arrToInsert, $fname = 'DatabaseMssql::insert', $options = array() ) {
# No rows to insert, easy just return now
* Source items may be literals rather than field names, but strings should be quoted with Database::addQuotes()
* $conds may be "*" to copy the whole table
* srcTable may be an array of tables.
+ * @return null|\ResultWrapper
*/
function insertSelect( $destTable, $srcTable, $varMap, $conds, $fname = 'DatabaseMssql::insertSelect',
$insertOptions = array(), $selectOptions = array() ) {
/**
* Return the next in a sequence, save the value for retrieval via insertId()
+ * @return
*/
function nextSequenceValue( $seqName ) {
if ( !$this->tableExists( 'sequence_' . $seqName ) ) {
/**
* Return the current value of a sequence. Assumes it has ben nextval'ed in this session.
+ * @return
*/
function currentSequenceValue( $seqName ) {
$ret = sqlsrv_query( $this->mConn, "SELECT TOP 1 id FROM [sequence_$seqName] ORDER BY id DESC" );
* $sql string SQL query we will append the limit too
* $limit integer the SQL limit
* $offset integer the SQL offset (default false)
+ * @return mixed|string
*/
function limitResult( $sql, $limit, $offset = false ) {
if ( $offset === false || $offset == 0 ) {
/**
* Query whether a given column exists in the mediawiki schema
+ * @return bool
*/
function fieldExists( $table, $field, $fname = 'DatabaseMssql::fieldExists' ) {
$table = $this->tableName( $table );
* Escapes a identifier for use inm SQL.
* Throws an exception if it is invalid.
* Reference: http://msdn.microsoft.com/en-us/library/aa224033%28v=SQL.80%29.aspx
+ * @return string
*/
private function escapeIdentifier( $identifier ) {
if ( strlen( $identifier ) == 0 ) {
/**
* @private
+ * @return string
*/
function tableNamesWithUseIndexOrJOIN( $tables, $use_index = array(), $join_conds = array() ) {
$ret = array();
/**
* Get the type of the DBMS, as it appears in $wgDBtype.
+ * @return string
*/
function getType(){
return 'mssql';
/**
* Since MSSQL doesn't recognize the infinity keyword, set date manually.
* @todo Remove magic date
+ * @return string
*/
public function getInfinity() {
return '3000-01-31 00:00:00.000';
/**
* Usually aborts on failure
+ * @return DatabaseBase|null
*/
function open( $server, $user, $password, $dbName ) {
if ( !function_exists( 'oci_connect' ) ) {
/**
* Closes a database connection, if it is open
* Returns success, true if already closed
+ * @return bool
*/
function close() {
$this->mOpened = false;
/**
* This must be called after nextSequenceVal
+ * @return null
*/
function insertId() {
return $this->mInsertId;
/**
* Returns information about an index
* If errors are explicitly ignored, returns NULL on failure
+ * @return bool
*/
function indexInfo( $table, $index, $fname = 'DatabaseOracle::indexExists' ) {
return false;
}
/**
* Return the next in a sequence, save the value for retrieval via insertId()
+ * @return null
*/
function nextSequenceValue( $seqName ) {
$res = $this->query( "SELECT $seqName.nextval FROM dual" );
/**
* Return sequence_name if table has a sequence
+ * @return bool
*/
private function getSequenceData( $table ) {
if ( $this->sequenceData == null ) {
/**
* Query whether a given index exists
+ * @return bool
*/
function indexExists( $table, $index, $fname = 'DatabaseOracle::indexExists' ) {
$table = $this->tableName( $table );
/**
* Query whether a given table exists (in the given schema, or the default mw one if not given)
+ * @return int
*/
function tableExists( $table, $fname = __METHOD__ ) {
$table = $this->tableName( $table );
/**
* Usually aborts on failure
+ * @return DatabaseBase|null
*/
function open( $server, $user, $password, $dbName ) {
# Test for Postgres support, to avoid suppressed fatal error
/**
* Closes a database connection, if it is open
* Returns success, true if already closed
+ * @return bool
*/
function close() {
$this->mOpened = false;
/**
* This must be called after nextSequenceVal
+ * @return null
*/
function insertId() {
return $this->mInsertId;
* This is not necessarily an accurate estimate, so use sparingly
* Returns -1 if count cannot be found
* Takes same arguments as Database::select()
+ * @return int
*/
function estimateRowCount( $table, $vars = '*', $conds='', $fname = 'DatabasePostgres::estimateRowCount', $options = array() ) {
$options['EXPLAIN'] = true;
/**
* Returns information about an index
* If errors are explicitly ignored, returns NULL on failure
+ * @return bool|null
*/
function indexInfo( $table, $index, $fname = 'DatabasePostgres::indexInfo' ) {
$sql = "SELECT indexname FROM pg_indexes WHERE tablename='$table'";
* $conds may be "*" to copy the whole table
* srcTable may be an array of tables.
* @todo FIXME: Implement this a little better (seperate select/insert)?
+ * @return bool
*/
function insertSelect( $destTable, $srcTable, $varMap, $conds, $fname = 'DatabasePostgres::insertSelect',
$insertOptions = array(), $selectOptions = array() )
/**
* Return the next in a sequence, save the value for retrieval via insertId()
+ * @return null
*/
function nextSequenceValue( $seqName ) {
$safeseq = str_replace( "'", "''", $seqName );
/**
* Return the current value of a sequence. Assumes it has been nextval'ed in this session.
+ * @return
*/
function currentSequenceValue( $seqName ) {
$safeseq = str_replace( "'", "''", $seqName );
/**
* Query whether a given relation exists (in the given schema, or the
* default mw one if not given)
+ * @return bool
*/
function relationExists( $table, $types, $schema = false ) {
global $wgDBmwschema;
/**
* For backward compatibility, this function checks both tables and
* views.
+ * @return bool
*/
function tableExists( $table, $fname = __METHOD__, $schema = false ) {
return $this->relationExists( $table, array( 'r', 'v' ), $schema );
/**
* Query whether a given schema exists. Returns true if it does, false if it doesn't.
+ * @return bool
*/
function schemaExists( $schema ) {
$exists = $this->selectField( '"pg_catalog"."pg_namespace"', 1,
/**
* Returns true if a given role (i.e. user) exists, false otherwise.
+ * @return bool
*/
function roleExists( $roleName ) {
$exists = $this->selectField( '"pg_catalog"."pg_roles"', 1,
/**
* pg_field_type() wrapper
+ * @return string
*/
function fieldType( $res, $index ) {
if ( $res instanceof ResultWrapper ) {
/**
* Based on generic method (parent) with some prior SQLite-sepcific adjustments
+ * @return bool
*/
function insert( $table, $a, $fname = 'DatabaseSqlite::insert', $options = array() ) {
if ( !count( $a ) ) {
/**
* No-op version of deadlockLoop
+ * @return mixed
*/
public function deadlockLoop( /*...*/ ) {
$args = func_get_args();
/**
* Returns internal log array
+ * @return array
*/
public static function getLog() {
return self::$log;
*
* @param $otext String: old text, must be already segmented
* @param $ntext String: new text, must be already segmented
+ * @return bool|string
*/
function generateDiffBody( $otext, $ntext ) {
global $wgExternalDiffEngine, $wgContLang;
/**
* Generate a debug comment indicating diff generating time,
* server node, and generator backend.
+ * @return string
*/
protected function debug( $generator = "internal" ) {
global $wgShowHostnames;
/**
* Replace line numbers with the text in the user's language
+ * @return mixed
*/
function localiseLineNumbers( $text ) {
return preg_replace_callback( '/<!--LINE (\d+)-->/',
* SHA-1 content hash.
*
* STUB
+ * @return array
*/
public function findBySha1( $hash ) {
return array();
* Get the name of an image from its title object
*
* @param $title Title
+ * @return String
*/
public function getNameFromTitle( Title $title ) {
global $wgContLang;
* be archived, if there is one. Relative to the public zone root.
* @param $flags Integer: bitfield, may be FileRepo::DELETE_SOURCE to indicate
* that the source file should be deleted if possible
+ * @return FileRepoStatus
*/
public function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) {
$status = $this->publishBatch( array( array( $srcPath, $dstRel, $archiveRel ) ), $flags );
* The parameters are the parts of the key, as for wfMemcKey().
*
* STUB
+ * @return bool
*/
function getSharedCacheKey( /*...*/ ) {
return false;
/**
* No-ops
+ * @return bool
*/
function storeBatch( $triplets, $flags = 0 ) {
* @param $width
* @param $height
* @param String $param Other rendering parameters (page number, etc) from handler's makeParamString.
+ * @return bool|string
*/
function getThumbUrlFromCache( $name, $width, $height, $params="" ) {
global $wgMemc;
/**
* @see FileRepo::getZoneUrl()
+ * @return String
*/
function getZoneUrl( $zone ) {
switch ( $zone ) {
/**
* Get the local directory corresponding to one of the basic zones
+ * @return bool|null|string
*/
function getZonePath( $zone ) {
$supported = array( 'public', 'thumb' );
/**
* The user agent the ForeignAPIRepo will use.
+ * @return string
*/
public static function getUserAgent() {
return Http::userAgent() . " ForeignAPIRepo/" . self::VERSION;
/**
* Like a Http:get request, but with custom User-Agent.
* @see Http:get
+ * @return bool|String
*/
public static function httpGet( $url, $timeout = 'default', $options = array() ) {
$options['timeout'] = $timeout;
$options['method'] = "GET";
if ( !isset( $options['timeout'] ) ) {
- $options['timeout'] = 'default';
+ $options['timeout'] = 'default';
}
$req = MWHttpRequest::factory( $url, $options );
$status = $req->execute();
if ( $status->isOK() ) {
- return $req->getContent();
+ return $req->getContent();
} else {
- return false;
+ return false;
}
}
* Get a key on the primary cache for this repository.
* Returns false if the repository's cache is not accessible at this site.
* The parameters are the parts of the key, as for wfMemcKey().
+ * @return bool|mixed
*/
function getSharedCacheKey( /*...*/ ) {
if ( $this->hasSharedCache() ) {
* Get a key on the primary cache for this repository.
* Returns false if the repository's cache is not accessible at this site.
* The parameters are the parts of the key, as for wfMemcKey().
+ * @return bool|string
*/
function getSharedCacheKey( /*...*/ ) {
if ( $this->hasSharedCache() ) {
* We can't say Title object, what database it should use, so we duplicate that function here.
*
* @param $title Title
+ * @return bool|int|mixed
*/
protected function getArticleID( $title ) {
if( !$title instanceof Title ) {
/**
* Get a connection to the slave DB
+ * @return DatabaseBase
*/
function getSlaveDB() {
return wfGetDB( DB_SLAVE );
/**
* Get a connection to the master DB
+ * @return DatabaseBase
*/
function getMasterDB() {
return wfGetDB( DB_MASTER );
/**
* Interface for FileRepo::checkRedirect()
+ * @return bool
*/
function checkRedirect( Title $title ) {
if ( !$this->reposInitialised ) {
/**
* Get the repo instance with a given key.
+ * @return bool|LocalRepo
*/
function getRepo( $index ) {
if ( !$this->reposInitialised ) {
}
/**
* Get the repo instance by its name
+ * @return bool
*/
function getRepoByName( $name ) {
if ( !$this->reposInitialised ) {
*
* @param $callback Callback: the function to call
* @param $params Array: optional additional parameters to pass to the function
+ * @return bool
*/
function forEachForeignRepo( $callback, $params = array() ) {
foreach( $this->foreignRepos as $repo ) {
/**
* @see FileBackendStore::resolveContainerPath()
+ * @return null|string
*/
protected function resolveContainerPath( $container, $relStoragePath ) {
// Check that container has a root directory
/**
* @see FileBackendStore::isPathUsableInternal()
+ * @return bool
*/
public function isPathUsableInternal( $storagePath ) {
$fsPath = $this->resolveToFSPath( $storagePath );
/**
* @see FileBackendStore::doStoreInternal()
+ * @return Status
*/
protected function doStoreInternal( array $params ) {
$status = Status::newGood();
/**
* @see FileBackendStore::doCopyInternal()
+ * @return Status
*/
protected function doCopyInternal( array $params ) {
$status = Status::newGood();
/**
* @see FileBackendStore::doMoveInternal()
+ * @return Status
*/
protected function doMoveInternal( array $params ) {
$status = Status::newGood();
/**
* @see FileBackendStore::doDeleteInternal()
+ * @return Status
*/
protected function doDeleteInternal( array $params ) {
$status = Status::newGood();
/**
* @see FileBackendStore::doCreateInternal()
+ * @return Status
*/
protected function doCreateInternal( array $params ) {
$status = Status::newGood();
/**
* @see FileBackendStore::doPrepareInternal()
+ * @return Status
*/
protected function doPrepareInternal( $fullCont, $dirRel, array $params ) {
$status = Status::newGood();
/**
* @see FileBackendStore::doSecureInternal()
+ * @return Status
*/
protected function doSecureInternal( $fullCont, $dirRel, array $params ) {
$status = Status::newGood();
/**
* @see FileBackendStore::doCleanInternal()
+ * @return Status
*/
protected function doCleanInternal( $fullCont, $dirRel, array $params ) {
$status = Status::newGood();
/**
* @see FileBackendStore::doFileExists()
+ * @return array|bool|null
*/
protected function doGetFileStat( array $params ) {
$source = $this->resolveToFSPath( $params['src'] );
/**
* @see FileBackendStore::getFileListInternal()
+ * @return array|FSFileBackendFileList|null
*/
public function getFileListInternal( $fullCont, $dirRel, array $params ) {
list( $b, $shortCont, $r ) = FileBackend::splitStoragePath( $params['dir'] );
/**
* @see FileBackendStore::getLocalReference()
+ * @return FSFile|null
*/
public function getLocalReference( array $params ) {
$source = $this->resolveToFSPath( $params['src'] );
/**
* @see FileBackendStore::getLocalCopy()
+ * @return null|TempFSFile
*/
public function getLocalCopy( array $params ) {
$source = $this->resolveToFSPath( $params['src'] );
/**
* @see FileBackendStore::moveInternal()
+ * @return Status
*/
protected function doMoveInternal( array $params ) {
// Copy source to dest
/**
* @see FileBackend::concatenate()
+ * @return Status
*/
final public function concatenate( array $params ) {
wfProfileIn( __METHOD__ );
/**
* @see FileBackendStore::concatenate()
+ * @return Status
*/
protected function doConcatenate( array $params ) {
$status = Status::newGood();
/**
* @see FileBackend::doPrepare()
+ * @return Status
*/
final protected function doPrepare( array $params ) {
wfProfileIn( __METHOD__ );
/**
* @see FileBackendStore::doPrepare()
+ * @return Status
*/
protected function doPrepareInternal( $container, $dir, array $params ) {
return Status::newGood();
/**
* @see FileBackend::doSecure()
+ * @return Status
*/
final protected function doSecure( array $params ) {
wfProfileIn( __METHOD__ );
/**
* @see FileBackendStore::doSecure()
+ * @return Status
*/
protected function doSecureInternal( $container, $dir, array $params ) {
return Status::newGood();
/**
* @see FileBackend::doClean()
+ * @return Status
*/
final protected function doClean( array $params ) {
wfProfileIn( __METHOD__ );
/**
* @see FileBackendStore::doClean()
+ * @return Status
*/
protected function doCleanInternal( $container, $dir, array $params ) {
return Status::newGood();
/**
* @see FileBackend::fileExists()
+ * @return bool|null
*/
final public function fileExists( array $params ) {
wfProfileIn( __METHOD__ );
/**
* @see FileBackend::getFileTimestamp()
+ * @return bool
*/
final public function getFileTimestamp( array $params ) {
wfProfileIn( __METHOD__ );
/**
* @see FileBackend::getFileSize()
+ * @return bool
*/
final public function getFileSize( array $params ) {
wfProfileIn( __METHOD__ );
/**
* @see FileBackend::getFileStat()
+ * @return bool|void
*/
final public function getFileStat( array $params ) {
wfProfileIn( __METHOD__ );
/**
* @see FileBackend::getFileContents()
+ * @return bool|string
*/
public function getFileContents( array $params ) {
wfProfileIn( __METHOD__ );
/**
* @see FileBackend::getFileSha1Base36()
+ * @return bool
*/
final public function getFileSha1Base36( array $params ) {
wfProfileIn( __METHOD__ );
/**
* @see FileBackendStore::getFileSha1Base36()
+ * @return bool
*/
protected function doGetFileSha1Base36( array $params ) {
$fsFile = $this->getLocalReference( $params );
/**
* @see FileBackend::getFileProps()
+ * @return Array
*/
final public function getFileProps( array $params ) {
wfProfileIn( __METHOD__ );
/**
* @see FileBackend::getLocalReference()
+ * @return null|\TempFSFile
*/
public function getLocalReference( array $params ) {
wfProfileIn( __METHOD__ );
/**
* @see FileBackend::streamFile()
+ * @return Status
*/
final public function streamFile( array $params ) {
wfProfileIn( __METHOD__ );
/**
* @see FileBackendStore::streamFile()
+ * @return Status
*/
protected function doStreamFile( array $params ) {
$status = Status::newGood();
}
/**
- * @copydoc FileBackend::getFileList()
+ * @copydoc FileBackend::getFileList()
+ * @return Array|FileBackendStoreShardListIterator|null|Traversable
*/
final public function getFileList( array $params ) {
list( $fullCont, $dir, $shard ) = $this->resolveStoragePath( $params['dir'] );
/**
* @see FileBackend::doOperationsInternal()
+ * @return Status
*/
protected function doOperationsInternal( array $ops, array $opts ) {
wfProfileIn( __METHOD__ );
/**
* @see FileBackend::doOperationsInternal()
+ * @return Status
*/
final protected function doOperationsInternal( array $ops, array $opts ) {
$status = Status::newGood();
/**
* @see FileBackend::doPrepare()
+ * @return Status
*/
public function doPrepare( array $params ) {
$status = Status::newGood();
/**
* @see FileBackend::doSecure()
+ * @return Status
*/
public function doSecure( array $params ) {
$status = Status::newGood();
/**
* @see FileBackend::doClean()
+ * @return Status
*/
public function doClean( array $params ) {
$status = Status::newGood();
/**
* @see FileBackendStore::resolveContainerPath()
+ * @return null
*/
protected function resolveContainerPath( $container, $relStoragePath ) {
if ( strlen( urlencode( $relStoragePath ) ) > 1024 ) {
/**
* @see FileBackendStore::isPathUsableInternal()
+ * @return bool
*/
public function isPathUsableInternal( $storagePath ) {
list( $container, $rel ) = $this->resolveStoragePathReal( $storagePath );
/**
* @see FileBackendStore::doCreateInternal()
+ * @return Status
*/
protected function doCreateInternal( array $params ) {
$status = Status::newGood();
/**
* @see FileBackendStore::doStoreInternal()
+ * @return Status
*/
protected function doStoreInternal( array $params ) {
$status = Status::newGood();
/**
* @see FileBackendStore::doCopyInternal()
+ * @return Status
*/
protected function doCopyInternal( array $params ) {
$status = Status::newGood();
/**
* @see FileBackendStore::doDeleteInternal()
+ * @return Status
*/
protected function doDeleteInternal( array $params ) {
$status = Status::newGood();
/**
* @see FileBackendStore::doPrepareInternal()
+ * @return Status
*/
protected function doPrepareInternal( $fullCont, $dir, array $params ) {
$status = Status::newGood();
/**
* @see FileBackendStore::doSecureInternal()
+ * @return Status
*/
protected function doSecureInternal( $fullCont, $dir, array $params ) {
$status = Status::newGood();
/**
* @see FileBackendStore::doCleanInternal()
+ * @return Status
*/
protected function doCleanInternal( $fullCont, $dir, array $params ) {
$status = Status::newGood();
/**
* @see FileBackendStore::doFileExists()
+ * @return array|bool|null
*/
protected function doGetFileStat( array $params ) {
list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $params['src'] );
/**
* @see FileBackend::getFileContents()
+ * @return bool|null|string
*/
public function getFileContents( array $params ) {
list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $params['src'] );
/**
* @see FileBackendStore::getFileListInternal()
+ * @return SwiftFileBackendFileList
*/
public function getFileListInternal( $fullCont, $dir, array $params ) {
return new SwiftFileBackendFileList( $this, $fullCont, $dir );
/**
* @see FileBackendStore::doGetFileSha1base36()
+ * @return bool
*/
public function doGetFileSha1base36( array $params ) {
$stat = $this->getFileStat( $params );
/**
* @see FileBackendStore::doStreamFile()
+ * @return Status
*/
protected function doStreamFile( array $params ) {
$status = Status::newGood();
/**
* @see FileBackendStore::getLocalCopy()
+ * @return null|TempFSFile
*/
public function getLocalCopy( array $params ) {
list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $params['src'] );
/**
* @see LockManager::doLock()
+ * @return Status
*/
protected function doLock( array $paths, $type ) {
$status = Status::newGood();
/**
* @see LockManager::doUnlock()
+ * @return Status
*/
protected function doUnlock( array $paths, $type ) {
$status = Status::newGood();
* Get handler-specific metadata
* Overridden by LocalFile, UnregisteredLocalFile
* STUB
+ * @return bool
*/
public function getMetadata() {
return false;
* Return the bit depth of the file
* Overridden by LocalFile
* STUB
+ * @return int
*/
public function getBitDepth() {
return 0;
* Return the size of the image file, in bytes
* Overridden by LocalFile, UnregisteredLocalFile
* STUB
+ * @return bool
*/
public function getSize() {
return false;
* Use the value returned by this function with the MEDIATYPE_xxx constants.
* Overridden by LocalFile,
* STUB
+ * @return string
*/
function getMediaType() {
return MEDIATYPE_UNKNOWN;
/**
* Accessor for __get()
+ * @return bool
*/
protected function getCanRender() {
return $this->canRender();
* Get all thumbnail names previously generated for this file
* STUB
* Overridden by LocalFile
+ * @return array
*/
function getThumbnails() {
return array();
*
* STUB
* Overridden in LocalFile
+ * @return bool
*/
public function nextHistoryLine() {
return false;
/**
* Return the deletion bitfield
* STUB
+ * @return int
*/
function getVisibility() {
return 0;
/**
* Get the property string for iiprop and aiprop
+ * @return string
*/
static function getProps() {
return 'timestamp|user|comment|url|size|sha1|metadata|mime';
/**
* Only useful if we're locally caching thumbs anyway...
+ * @return null|string
*/
function getThumbPath( $suffix = '' ) {
if ( $this->repo->canCacheThumbs() ) {
/**
* Fields in the image table
+ * @return array
*/
static function selectFields() {
return array(
/**
* Get the memcached key for the main data for this file, or false if
* there is no access to the shared cache.
+ * @return bool
*/
function getCacheKey() {
$hashedName = md5( $this->getName() );
/**
* Try to load file metadata from memcached. Returns true on success.
+ * @return bool
*/
function loadFromCache() {
global $wgMemc;
/**
* Decode a row from the database (either object or array) to an array
* with timestamps and MIME types decoded, and the field prefix removed.
+ * @return array
*/
function decodeRow( $row, $prefix = 'img_' ) {
$array = (array)$row;
* Return the width of the image
*
* Returns false on error
+ * @return bool
*/
public function getWidth( $page = 1 ) {
$this->load();
* Return the height of the image
*
* Returns false on error
+ * @return bool
*/
public function getHeight( $page = 1 ) {
$this->load();
/**
* Get handler-specific metadata
+ * @return string
*/
function getMetadata() {
$this->load();
* 0 return line for current version
* 1 query for old versions, return first one
* 2, ... return next old version from above query
+ * @return bool
*/
public function nextHistoryLine() {
# Polymorphic function name to distinguish foreign and local fetches
/**
* Record a file upload in the upload log and the image table
+ * @return bool
*/
function recordUpload( $oldver, $desc, $license = '', $copyStatus = '', $source = '',
$watch = false, $timestamp = false )
/**
* Record a file upload in the upload log and the image table
+ * @return bool
*/
function recordUpload2(
$oldver, $comment, $pageText, $props = false, $timestamp = false, $user = null
/**
* Get the URL of the file description page.
+ * @return String
*/
function getDescriptionUrl() {
return $this->title->getLocalUrl();
* Get the HTML text of the description page
* This is not used by ImagePage for local files, since (among other things)
* it skips the parser cache.
+ * @return bool|mixed
*/
function getDescriptionText() {
global $wgParser;
/**
* Run the transaction
+ * @return \FileRepoStatus
*/
function execute() {
global $wgUseSquid;
/**
* Removes non-existent files from a deletion batch.
+ * @return array
*/
function removeNonexistentFiles( $batch ) {
$files = $newBatch = array();
* rows and there's no need to keep the image row locked while it's acquiring those locks
* The caller may have its own transaction open.
* So we save the batch and let the caller call cleanup()
+ * @return \FileRepoStatus
*/
function execute() {
global $wgLang;
/**
* Removes non-existent files from a store batch.
+ * @return array
*/
function removeNonexistentFiles( $triplets ) {
$files = $filteredTriplets = array();
/**
* Removes non-existent files from a cleanup batch.
+ * @return array
*/
function removeNonexistentFromCleanup( $batch ) {
$files = $newBatch = array();
/**
* Delete unused files in the deleted zone.
* This should be called from outside the transaction in which execute() was called.
+ * @return \FileRepoStatus|void
*/
function cleanup() {
if ( !$this->cleanupBatch ) {
/**
* Perform the move.
+ * @return \FileRepoStatus
*/
function execute() {
$repo = $this->file->repo;
/**
* Generate triplets for FileRepo::storeBatch().
+ * @return array
*/
function getMoveTriplets() {
$moves = array_merge( array( $this->cur ), $this->olds );
/**
* Removes non-existent files from move batch.
+ * @return array
*/
function removeNonexistentFiles( $triplets ) {
$files = array();
/**
* Fields in the oldimage table
+ * @return array
*/
static function selectFields() {
return array(